package de.devisnik.eidle.app;

import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

import de.devisnik.eidle.util.Parameters;
import de.devisnik.eidle.util.ScreenUtils;


public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {

	private static final String PERSPECTIVE_ID = EidlePerspective.ID;
	private final Parameters parameters;

	public ApplicationWorkbenchAdvisor(Parameters parameters) {
		this.parameters = parameters;
	}
	
	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
			IWorkbenchWindowConfigurer configurer) {
		return new ApplicationWorkbenchWindowAdvisor(configurer, parameters);
	}

	public String getInitialWindowPerspectiveId() {
		return PERSPECTIVE_ID;
	}

	public void preStartup() {
		Image snapShot = ScreenUtils.takeScreenShot(getWorkbenchConfigurer().getWorkbench().getDisplay());
		ScreenUtils.setScreenImage(snapShot);
	}
}
